import java.util.Arrays;
import java.util.Scanner;

import org.korifey.ffalg.NumberTheory;


public class Problem12 {
	
	public static void main(String[] args) {
		System.out.println(solve());
	}

	public static long solve() {
		int nfactors = 500;
		long nxt = 2;
		while (true) {			
			

			long a = nxt;
			long b = nxt+1;
			if (a%2 == 0) a /= 2;
			else b /=2;

			long accA = 1;
			long accB = 1;
			for (long i=2; i<=nxt+1; i++) {
				if (a % i == 0) {
					accA++;
				} else if (b%i == 0) {
					accB++;
				}
			}
			if (accA*accB >= nfactors) {
				return nxt*(nxt+1)/2;
			}
			
			nxt++;
		}
	}
	
}
